package com.zhuangjie.mvc.validator.annotate;

import com.zhuangjie.mvc.validator.handler.PositiveNumberValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * 验证正数，验证属性类型是String类型
 */
@Target({METHOD, FIELD})
@Retention(RUNTIME)
@Constraint(validatedBy = PositiveNumberValidator.class)
public @interface PositiveNumber {
    String message() default "must be a positive number";
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
}
